package com.zhiyou100.config;

import com.sun.org.apache.regexp.internal.RE;
import com.zhiyou100.filter.FilterTest01;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.FilterRegistration;

/**
 * 过滤器 配置类
 *
 * 创建一个配置类 用于注册所有的过滤器
 *
 * @author yang
 * @version 1.0.0
 * @date 2020-10-19 23:13
 */
@Configuration
public class FilterConfigure {
    @Bean
    public FilterRegistrationBean registFilterTest01() {
        final FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new FilterTest01());
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.setName("test_filter1");
        filterRegistrationBean.setOrder(1);
        return filterRegistrationBean;
    }
}
